package com.virgo.demo.market.converter;

import com.virgo.common.converter.BaseConverter;
import com.virgo.common.utils.ITimeUtils;
import com.virgo.demo.market.domain.AdvDo;
import com.virgo.demo.market.domain.vo.AdvVo;
import com.virgo.demo.support.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AdvConverter extends BaseConverter<AdvDo, AdvVo> {

    @Autowired
    private AppService appService;

	@Override
	protected void convert(AdvDo from, AdvVo to) {
		to.setStartTime(ITimeUtils.localDate("yyyy-MM-dd HH:mm:ss",from.getStartTime()));
		to.setEndTime(ITimeUtils.localDate("yyyy-MM-dd HH:mm:ss",from.getEndTime()));
		to.setCreatedAt(ITimeUtils.localDate(from.getCreatedAt()));
		to.setUpdatedAt(ITimeUtils.localDate(from.getUpdatedAt()));
        to.setContentShow(appService.getStaticUrl(from.getContent()));
		super.convert(from, to);
	}
}